<?php
/**
 * Created by PhpStorm.
 * User: huanglintian
 * Date: 2019/5/14
 * Time: 9:28
 */

//var_export(json_decode('{"config":{"debug":false,"timestamp":1557797249,"nonceStr":"nk2bDx2aQifbx7Mb","signature":"f2562f4c53a62dcc3a0585ca73b9556ae869862c","appId":"wx98l8dl5mw98xn0ld.","jsApiList":["onMenuShareTimeline","onMenuShareAppMessage","hideMenuItems","showMenuItems","hideOptionMenu"]},"qun":["2px1nc","cn"],"quan":["2px1nc","cn"]}', true));

$data = require './data.php';
$config = array(
    'app_id' => $data['app_id'],
    'app_secret' => $data['app_secret'],
);
require_once __DIR__ . "/wechat/jssdk.php";
require_once "include.php";
@$jssdk = new JSSDK($config['app_id'], $config['app_secret']);
@$signPackage = $jssdk->GetSignPackage();


$rand = str_rand2(5);

$domain = $data['d4'];
//$time = time();
$time = strtotime(date('Y-m-d H:0:0'));
@$port = "http://{$domain}?file={$rand}.html&_t={$time}&xxid=" . intval($data['desc']);
$ad = $data['back_url'] ? "http://{$domain}?file={$rand}.html&_t={$time}&xxid=" . intval($data['desc']) . "&path=http://www.baidu.com" : $port;


return array (
    'config' =>
        array (
            'debug' => false,
            'timestamp' => $signPackage['timestamp'],
            'nonceStr' => $signPackage['nonceStr'],
            'signature' => $signPackage['signature'],
            'appId' => $signPackage['appId'],
            'jsApiList' =>
                array (
                    0 => 'onMenuShareTimeline',
                    1 => 'onMenuShareAppMessage',
                    2 => 'hideMenuItems',
                    3 => 'showMenuItems',
                    4 => 'hideOptionMenu',
                ),
        ),
    'qun' =>
        array (
            0 => '2px1nc',
            1 => 'cn',
        ),
    'quan' =>
        array (
            0 => '2px1nc',
            1 => 'cn',
        ),
    'port' => $port,
    'ad' => $ad,
);